//
//  UnsubscribeListener.swift
//  uwantgoeasy
//
//  Created by 冯传宝 on 12/17/15.
//  Copyright © 2015 uwantsoft. All rights reserved.
//

import Foundation

public class UnsubscribeListener {
    private var goEasy:GoEasy?
    
    public init(){}
    final func onUnsubscribeResult(unsubscribeResult: UnsubscribeResult) {
        if(MessageCode.OK.rawValue == unsubscribeResult.typeCode()){
            goEasy!.onUnsubscribeSuccess(unsubscribeResult._channel);
            onSuccess();
        }else{
            onFailed(GoEasyError(code: unsubscribeResult._resultCode,content: unsubscribeResult._content));
        }
    }
    
    public func onSuccess() {
    
    }
    
    public func onFailed(error: GoEasyError) {
    
    }
    
    final func goeasy(goEasy: GoEasy){
        self.goEasy = goEasy;
    }
}